package routers

import (
	"mini-app/internal/app/web/controller"
	"mini-app/internal/app/web/middleware"

	"github.com/gin-gonic/gin"
)

// webGroup 小程序前端路由
func advertisementGroup(router *gin.RouterGroup) {

	// 广告
	{
		router.GET("/nonauth/login", controller.Advertisement{}.Login) // 登录授权

		router.GET("/nonauth/device/all", controller.Advertisement{}.AllDeviceAd)         // 所有设备
		router.GET("/nonauth/device/list", controller.Advertisement{}.DeviceListAd)       // 设备列表
		router.GET("/nonauth/device/detail", controller.Advertisement{}.DeviceDetailAd)   // 设备详情
		router.POST("/nonauth/create-order", controller.Advertisement{}.CreateOrder)      // 创建订单
		router.POST("/nonauth/upload/file-upload", controller.Advertisement{}.FileUpload) //测试
		router.POST("/nonauth/schedule/detail", controller.Advertisement{}.ScheduleDetail)

		router.POST("/wechat-v3-notify", controller.Advertisement{}.WechatV3NotifyAd) // 微信支付回调
		router.POST("/order-all", controller.Advertisement{}.OrderAll)                // 查询订单
		router.POST("/order-modify", controller.Advertisement{}.OrderModify)          // 修改订单备注
		router.POST("/order-list-test", controller.Advertisement{}.OrderList)         // 查询订单

		router.POST("/set-baseprice", controller.AdConfig{}.SetBasePrice)       // 设置基础价格
		router.POST("/get-baseprice", controller.AdConfig{}.GetBasePrice)       // 查看基础价格
		router.POST("/set-searchradius", controller.AdConfig{}.SetSearchRadius) // 设置搜索半径
		router.POST("/get-searchradius", controller.AdConfig{}.GetSearchRadius) // 查看搜索半径
		router.POST("/create-coupon", controller.AdCoupon{}.Create)             // 设置优惠
		router.POST("/get-coupon", controller.AdCoupon{}.GetCoupons)            // 获取优惠列表
		router.POST("/modify-coupon", controller.AdCoupon{}.ModifyByID)         // 修改优惠
		router.POST("/delete-coupon", controller.AdCoupon{}.DeleteByID)         // 删除优惠

		router.POST("publish-device-list", controller.PublishDevice{}.PublishDeviceList)                // 投放设备组设备列表
		router.POST("publish-device-group-list", controller.PublishDevice{}.PublishDeviceGroupList)     // 投放设备组列表
		router.POST("publish-device-group-save", controller.PublishDevice{}.PublishDeviceGroupSave)     // 投放设备组新增编辑
		router.POST("publish-device-group-delete", controller.PublishDevice{}.PublishDeviceGroupDelete) // 投放设备组删除
		router.POST("publish-device-group-manage", controller.PublishDevice{}.PublishDeviceGroupManage) // 投放设备组配置设备

		router.POST("/get-qrcode", controller.Advertisement{}.GetQrCode) // 获取二维码

		router.POST("/refund-list", controller.Advertisement{}.RefundList) // 微信退款查询

		router.Use(middleware.LoginCheckAd())
		router.GET("/get-phone-number", controller.Advertisement{}.GetPhoneNumber) // 获取手机号
		router.POST("/order-list", controller.Advertisement{}.OrderList)           // 查询订单
		router.POST("/order-detail", controller.Advertisement{}.OrderDetail)       // 订单详情

		router.POST("/refund", controller.Advertisement{}.Refund) // 微信退款

		router.Use(middleware.PhoneCheck())
		router.POST("/create-order", controller.Advertisement{}.CreateOrder)                    // 创建订单
		router.POST("/create-order-schedule", controller.Advertisement{}.CreateOrderBySchedule) // 创建订单
		router.POST("/wechat-jspay", controller.Advertisement{}.WechatJSPay)                    // 微信支付

		router.POST("/upload/file-upload", controller.Advertisement{}.FileUpload)
		router.POST("/material/save", controller.Advertisement{}.MaterialSave)
		router.POST("/material/list", controller.Advertisement{}.MaterialList)
		router.POST("/material/delete", controller.Advertisement{}.MaterialDelete)
		router.POST("/material/material-in-use-list", controller.Advertisement{}.MaterialInUseList)
		router.POST("/material/auditing-count", controller.Advertisement{}.AuditingMaterialCount)
		router.POST("/material/move-folder", controller.Advertisement{}.MoveFolder)

		router.POST("material/material-audit", controller.Advertisement{}.MaterialAudit) // 素材审核
		// 分组
		router.POST("/material/folder-save", controller.Advertisement{}.FolderSave)
		router.POST("/material/folder-list", controller.Advertisement{}.FolderList)
		router.POST("/material/folder-delete", controller.Advertisement{}.FolderDelete)
		router.POST("/material/folder-sort", controller.Advertisement{}.FolderSort)

		router.POST("/schedule/save", controller.Advertisement{}.ScheduleSave)
		router.POST("/schedule/list", controller.Advertisement{}.ScheduleList)
		router.POST("/schedule/detail", controller.Advertisement{}.ScheduleDetail)
		router.POST("/schedule/submit", controller.Advertisement{}.ScheduleSubmit)
		router.POST("/schedule/end", controller.Advertisement{}.End)
		router.POST("/schedule/auditing-count", controller.Advertisement{}.AuditingPublishScheduleCount)
		router.POST("/schedule/publishing-count", controller.Advertisement{}.PublishingPublishScheduleCount)
		router.POST("/schedule/schedule-calendar", controller.Advertisement{}.ScheduleCalendar)
		router.POST("/schedule/list-orderinfo", controller.Advertisement{}.ScheduleListOrderInfo)
		router.POST("/schedule/detail-orderinfo", controller.Advertisement{}.ScheduleDetailOrderInfo)

		// 支持活动
		router.POST("/support-activity/create", controller.Advertisement{}.SupportActivityCreate)                              // 创建支持活动
		router.POST("/support-activity/update", controller.Advertisement{}.SupportActivityUpdate)                                // 更新支持活动
		router.POST("/support-activity/delete", controller.Advertisement{}.SupportActivityDelete)                                // 删除支持活动
		router.POST("/support-activity/detail", controller.Advertisement{}.SupportActivityDetail)                                // 获取活动详情
		router.POST("/support-activity/list", controller.Advertisement{}.SupportActivityList)                                  // 获取支持活动列表
		router.POST("/support-activity/change-status", controller.Advertisement{}.SupportActivityChangeStatus)                 // 修改活动状态
		router.POST("/support-activity/same-name-exist", controller.Advertisement{}.SupportActivitySameNameExist)             // 检查同名活动是否存在
		router.POST("/support-activity/get-activity-list-by-material-ids", controller.Advertisement{}.SupportActivityGetActivityListByMaterialIDs) // 根据素材ID获取关联的活动列表
		router.POST("/support-activity/get-material-ids-list", controller.Advertisement{}.SupportActivityGetMaterialIDsList) // 获取活动关联的素材ID列表
		router.POST("/support-activity/set-material-ids", controller.Advertisement{}.SupportActivitySetMaterialIDs)          // 更新活动素材ID
	}

}
